result = pow(2022, 2023, 2023)
for i in range(2021, 1, -1):
    result = pow(i, result, 2023)
print(result % 2023)
